$(function () {
    var page = 1;
    var pageSize = 5;

    function render() {
        $.ajax({
            url: "/product/queryProductDetailList",
            type: "GET",
            data: {
                page: page,
                pageSize: pageSize
            },
            success: function (callback) {
                console.log(callback);
                // var html = template("product-list",callback);
                $("tbody").html(template("product-list", callback));

                $("#paginator").bootstrapPaginator({
                    bootstrapMajorVersion: 3,
                    currentPage: page,
                    totalPages: Math.ceil(callback.total / pageSize),
                    onPageClicked: function (a, b, c, index) {
                        page = index;
                        render();
                    }
                });
            }
        })
    }
    render()
})